// import typescript from '@rollup/plugin-typescript'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonJs from '@rollup/plugin-commonjs'
import esbuild from 'rollup-plugin-esbuild'
import vuePlugin from 'rollup-plugin-vue'
import VueSetupExtend from 'unplugin-vue-setup-extend/rollup'
import { defineConfig } from 'rollup'
import less from 'rollup-plugin-less'
// import externalGlobals from 'rollup-plugin-external-globals'

export default defineConfig({
  input: './src/plugin/route-plan/route-plan.vue',
  output: {
    name: 'plugin.routePlan',
    file: 'dist/plugin/route-plan.esm.js',
    format: 'umd',
    globals: {
      vue: 'Vue'
    },
    exports: 'named'
  },
  plugins: [
    vuePlugin(),
    VueSetupExtend(),
    nodeResolve(),

    less(),
    // typescript({
    //     declaration: true,
    //     declarationDir: "./types",
    // }),
    esbuild({
      target: 'es2018',
      minify: true,
      include: /\.[jt]sx?$/,
      loaders: {
        '.vue': 'ts'
      }
    }),
    // externalGlobals({
    //     vue: 'Vue',
    //     cesium: "Cesium"
    // }),
    commonJs()
  ],
  external: ['vue']
})
